package com.ethanzzh.ethanzzh_xdclass.provider;

import com.ethanzzh.ethanzzh_xdclass.model.pojo.UserInfo;
import com.ethanzzh.ethanzzh_xdclass.model.pojo.Video;
import org.apache.ibatis.jdbc.SQL;

public class UserInfoProvider {

    public String updateUserInfo(final UserInfo userInfo) {
        return new SQL() {{
            UPDATE("user_info");

            if (userInfo.getId() != null) {
                SET("phone = #{phone}");
            }

            if (userInfo.getAddress() != null) {
                SET("address=#{address}");
            }

            if (userInfo.getEnrolDate() != null) {
                SET("enrol_date=#{enrolDate}");
            }

            if (userInfo.getDes() != null) {
                SET("des=#{des}");
            }
            WHERE("name =#{name}");
        }}.toString();
    }
}
